{% extends "dashboard.html" %}

{% block content %}

    <h1 class="page-header">文章
        <small><a href="{% url 'article_add' %}">新增</a></small>
    </h1>

    <div class="table-responsive">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>#</th>
                    <th>ID</th>
                    <th>标题</th>
                    <th>主要分类</th>
                    <th>次级分类</th>
                    <th>创建时间</th>
                    <th>编辑 | 删除</th>
                </tr>
            </thead>


            <tbody>
                {% for article in articles %}
                    <tr>
                        <td>{{ forloop.counter }}</td>
                        <td>{{ article.pk }}</td>
                        <td>{{ article.title }}</td>
                        <td>{{ article.category }}</td>
                        <td>{{ article.subcategory }}</td>
                        <td>{{ article.create_time|date:"Y-m-d H:i:s" }}</td>



                        <td>
                            <a class="btn btn-sm btn-primary" href="{% url 'article_edit' article.pk %}">编辑</a>
                            <a class="btn btn-sm btn-danger" href="{% url 'article_delete' article.pk %}">删除</a>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>



        </table>


    </div>

{% endblock content %}
